/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * @author : asus
 */

function validateAddCategory(){
    if(document.getElementById("addcategory").value==""){
        alert("insert a name to create a category!");
        return false;
    }
    else return true;
}

function validateRemoveCategory(){
    if(document.getElementById("del_category").value==0){
        alert("select a category to delete!");
        return false;
    }
    else
        return true;
}

function validateUpdateCategory(){
    if(document.getElementById("choose_category").value==0){
        alert("select a category to update!");
        return false;
    }
    else if(document.getElementById("editcategory").value==""){
        alert("insert a name for the category!");
        return false;
    }
    else return true;
}

function validateAddModerator(){
    if(document.getElementById("selectmoderator_user").value==0){
        alert("select a user to set moderator!");
        return false;
    }
    else if(document.getElementById("selectmoderator_category").value==0){
        alert("select a category to set moderator");
        return false;
    }
    else{
        return true;
    }
}

function validateDelModerator(){
    if(document.getElementById("select_remModerator").value==0){
        alert("select a moderator to remove!");
        return false;
    }
    else{
        return true;
    }
}

function validateBan(){
    if(document.getElementById("select_banUser").value==0){
        alert("select a user to ban!");
        return false;
    }
    else{
        return true;
    }
}

function validateUnban(){
    if(document.getElementById("select_unbanUser").value==0){
        alert("select a user to unban!");
        return false;
    }
    else{
        return true;
    }
}

function validateMaxRoom(){
    var cek = /^[0-9]+$/;
    if(cek.test(document.getElementById("setmax").value)){
        return true
    }
    else{
        alert("input only number!");
        return false;
    }
}
